﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.DirectX;

namespace MapEngine
{
    public class IsometricMath
    {
        const double angle = 0.46365;
        public static Point PointFrom3d(Point3d point) {
            /*return new Point(
                (point.Position.X-point.Position.Y)*Math.Cos(angle),
                (-point.Height + (point.Position.X + point.Position.Y) * Math.Sin(angle))
                );*/
            return new Point(
                (point.Position.X-point.Position.Y)*Math.Cos(angle),
                (-point.Height + (point.Position.X + point.Position.Y) * Math.Sin(angle))
                );
        }

        
        public static Point PointFromV3d(Vector3 point)
        {
            return new Point(
                (point.X - point.Z) * Math.Cos(angle),
                (-point.Y + (point.X + point.Z) * Math.Sin(angle))
                );
        }
    }
}
